import time
from PageObject.login_page import LoginPage
import pytest
from selenium import webdriver
from selenium.webdriver.edge.service import  Service as EdgeService
from selenium.webdriver.common.by import By
from webdriver_manager.microsoft import EdgeChromiumDriverManager as EdgeDriverManager




# """启动浏览器配置"""
# 创建浏览器驱动 - 推荐使用Chrome
options = webdriver.ChromeOptions()
options.add_argument("--start-maximized")  # 最大化窗口
options.add_argument("--disable-infobars")  # 禁用信息栏
options.add_argument("--disable-extensions")  # 禁用扩展

# 忽略证书错误和安全告警
options.add_argument("--ignore-certificate-errors")
options.add_argument("--allow-insecure-localhost")

# 创建driver实例
#driver=webdriver.Edge(executable_path="D:\\auto-test\webdriver\edge\edgedriver_win64\msedgedriver.exe",options=options)
edge_service=EdgeService(executable_path="D:\\auto-test\webdriver\edge\edgedriver_win64-139.0.3405.86\msedgedriver.exe")
driver=webdriver.Edge(service=edge_service,options=options)
# driver = webdriver.Chrome(options=options)
driver.implicitly_wait(5)  # 隐式等待
# driver.add_cookie(cookie_dict=)
driver.get("www.baidu.com")
time.sleep(5)

# 测试结束后关闭浏览器
driver.quit()


